
#define ACLASS_RSA_GENKEY          0x50
#define ACLASS_RSA_PUB             0x51
#define ACLASS_RSA_PRIV            0x52
#define ACLASS_RSA_PRIV_CRT        0x53
#define ACLASS_RSA_PUB_BIG         0x54
#define ACLASS_RSA_PRIV_BIG        0x55
#define P4096_LEN  512
struct rsa4096_keygen_api
{
    unsigned int field;
    unsigned int rsa_random_bit;
    unsigned int fixed;
    unsigned int crt;
    unsigned char rsa_p[512];
    unsigned char rsa_q[512];
    unsigned char rsa_e[512];
    unsigned char rsa_n[512];
    unsigned char rsa_d[512];
    unsigned char rsa_dp[512];
    unsigned char rsa_dq[512];
    unsigned char rsa_qInv[512];
};

struct rsa4096_enc_api
{
	unsigned int mode;
	unsigned short e_len;
	unsigned short n_len;
	unsigned short a_len;
	unsigned short b_len;
	unsigned short a0_len;
	unsigned short a1_len;
	unsigned short a2_len;
	unsigned short a3_len;
	unsigned short b0_len;
	unsigned short b1_len;
	unsigned short b2_len;
	unsigned short b3_len;
	unsigned char rsa_e[512];
	unsigned char rsa_n[512];
	unsigned char rsa_plain[P4096_LEN];
	unsigned char rsa_c[512];
};


struct rsa4096_dec_nocrt_api
{
	unsigned int mode;
	unsigned short e_len;
	unsigned short n_len;
	unsigned short a_len;
	unsigned short b_len;
	unsigned short a0_len;
	unsigned short a1_len;
	unsigned short a2_len;
	unsigned short a3_len;
	unsigned short b0_len;
	unsigned short b1_len;
	unsigned short b2_len;
	unsigned short b3_len;
	unsigned char rsa_d[512];
	unsigned char rsa_n[512];
	unsigned char rsa_c[512];
	unsigned char rsa_plain[512];
};
struct rsa4096_dec_crt_api
{
	unsigned int mode;
	unsigned short e_len;
	unsigned short n_len;
	unsigned short a_len;
	unsigned short b_len;
	unsigned short a0_len;
	unsigned short a1_len;
	unsigned short a2_len;
	unsigned short a3_len;
	unsigned short b0_len;
	unsigned short b1_len;
	unsigned short b2_len;
	unsigned short b3_len;
	unsigned char rsa_n[512];
	unsigned char rsa_c[512];
	unsigned char rsa_plain[512];
	unsigned char rsa_p[512];
	unsigned char rsa_q[512];
	unsigned char rsa_dp[512];
	unsigned char rsa_dq[512];
	unsigned char rsa_qInv[512];
};
struct rsa4096_sign_crt_api
{
	unsigned int mode;
	unsigned short e_len;
	unsigned short n_len;
	unsigned short a_len;
	unsigned short b_len;
	unsigned short a0_len;
	unsigned short a1_len;
	unsigned short a2_len;
	unsigned short a3_len;
	unsigned short b0_len;
	unsigned short b1_len;
	unsigned short b2_len;
	unsigned short b3_len;
	unsigned char rsa_n[512];
	unsigned char rsa_plain[512];
	unsigned char rsa_sign[512];
	unsigned char rsa_p[512];
	unsigned char rsa_q[512];
	unsigned char rsa_dp[512];
	unsigned char rsa_dq[512];
	unsigned char rsa_qInv[512];
};
struct rsa4096_sign_nocrt_api
{
	unsigned int mode;
	unsigned short e_len;
	unsigned short n_len;
	unsigned short a_len;
	unsigned short b_len;
	unsigned short a0_len;
	unsigned short a1_len;
	unsigned short a2_len;
	unsigned short a3_len;
	unsigned short b0_len;
	unsigned short b1_len;
	unsigned short b2_len;
	unsigned short b3_len;
	unsigned char rsa_d[512];
	unsigned char rsa_n[512];
	unsigned char rsa_plain[512];
	unsigned char rsa_sign[512];
};
struct rsa4096_ver_api
{
	unsigned int mode;
	unsigned short e_len;
	unsigned short n_len;
	unsigned short a_len;
	unsigned short b_len;
	unsigned short a0_len;
	unsigned short a1_len;
	unsigned short a2_len;
	unsigned short a3_len;
	unsigned short b0_len;
	unsigned short b1_len;
	unsigned short b2_len;
	unsigned short b3_len;
	unsigned char rsa_e[512];
	unsigned char rsa_n[512];
	unsigned char rsa_signed[512];
	unsigned char rsa_ver_plain[512];
};


int ccp903_rsa4096_keygen(int ccp903_fd, unsigned char *rsa_e, unsigned int rsa_e_len, unsigned char *rsa_d, unsigned int *rsa_d_len, unsigned char *rsa_n, unsigned int *rsa_n_len, unsigned char *rsa_p, unsigned int *rsa_p_len, unsigned char *rsa_q, unsigned int *rsa_q_len, unsigned char *rsa_dp, unsigned int *rsa_dp_len, unsigned char *rsa_dq, unsigned int *rsa_dq_len, unsigned char *rsa_qInv, unsigned int *rsa_qInv_len);
int ccp903_rsa4096_encrpy(int ccp903_fd, unsigned char *rsa_e, unsigned int rsa_e_len, unsigned char *rsa_n, unsigned int rsa_n_len, unsigned char *rsa_plain, unsigned int rsa_plain_len, unsigned char *rsa_c, unsigned int *rsa_c_len);
int ccp903_rsa4096_decrypt_crt(int ccp903_fd, unsigned char *rsa_c, unsigned int rsa_c_len, unsigned char *rsa_n, unsigned int rsa_n_len, unsigned char *rsa_p, unsigned int rsa_p_len, unsigned char *rsa_q, unsigned int rsa_q_len, unsigned char *rsa_dp, unsigned int rsa_dp_len, unsigned char *rsa_dq, unsigned int rsa_dq_len, unsigned char *rsa_qInv, unsigned int rsa_qInv_len, unsigned char *rsa_plain, unsigned int *rsa_plain_len);
int ccp903_rsa4096_sign_crt(int ccp903_fd, unsigned char *rsa_plain, unsigned int rsa_plain_len, unsigned char *rsa_n, unsigned int rsa_n_len, unsigned char *rsa_p, unsigned int rsa_p_len, unsigned char *rsa_q, unsigned int rsa_q_len, unsigned char *rsa_dp, unsigned int rsa_dp_len, unsigned char *rsa_dq, unsigned int rsa_dq_len, unsigned char *rsa_qInv, unsigned int rsa_qInv_len, unsigned char *rsa_sign, unsigned int *rsa_sign_len);
int ccp903_rsa4096_verify(int ccp903_fd, unsigned char *rsa_plain, unsigned int rsa_plain_len, unsigned char *rsa_e, unsigned int rsa_e_len, unsigned char *rsa_n, unsigned int rsa_n_len, unsigned char *rsa_signed, unsigned int rsa_signed_len, unsigned char *rsa_ver_plain, unsigned int *rsa_ver_plain_len);
